AWS-Java-Spring cloud aws

  1. 使用方式

使用方式

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

@Component
public class Storage {

@Autowired
private ResourceLoader resourceLoader;

Logger logger = LoggerFactory.getLogger(this.getClass());

public Storage() {

}

public void writeResource() throws IOException {
Resource resource = this.resourceLoader.getResource("s3://server-images/rootFile.log");
WritableResource writableResource = (WritableResource) resource;
try (OutputStream outputStream = writableResource.getOutputStream()) {
outputStream.write("test".getBytes());
}
}
}
1
2
3
4
5
cloud.aws.credentials.accessKey = A******A
cloud.aws.credentials.secretKey = i******K

cloud.aws.credentials.instanceProfile = true
cloud.aws.region.auto = true

转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论,也可以邮件至 wshten@gmail.com

文章标题:AWS-Java-Spring cloud aws

本文作者:KevinTen

发布时间:2019-09-06, 00:00:00

最后更新:2019-09-14, 15:22:37

原始链接:http://github.com/kevinten10/2019/09/06/AWS/sdk/Aws-Java-Spring cloud aws/

版权声明: "署名-非商用-相同方式共享 4.0" 转载请保留原文链接及作者。

目录
×

喜欢就点赞,疼爱就打赏

csdn zhihu github